/*
 * FontMetricsDelegate.h  0.4.0 / Dec 04, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef FONTMETRICSDELEGATE_H
#define FONTMETRICSDELEGATE_H

#include "Cute4jSwing.h"

// FontMetricsDelegate Class. --------------------------------------------------

/*!
 * \brief FontMetrics Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT FontMetricsDelegate
{
public: // native calls
  static void getMetrics(JNIEnv *env, jobject obj, QFontMetrics *fontMetrics);
  static jint stringWidth(JNIEnv *env, jobject obj, QFontMetrics *fontMetrics,
                          jstring str);
  static void initialize(JNIEnv *env, jclass cls);
private:
  static jfieldID sm_ascentFID;
  static jfieldID sm_descentFID;
  static jfieldID sm_heightFID;
  static jfieldID sm_leadingFID;
  static jmethodID sm_stringWidthMID;
};

// Macro Definitions. ----------------------------------------------------------

#define FONT_METRICS (reinterpret_cast<QFontMetrics *>(fontMetricsPointer))

#endif // FONTMETRICSDELEGATE_H
